package com.bw.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootConfiguration
public class MyWebMvcConfig implements WebMvcConfigurer {

    //配置图片虚拟映射

    @Value("${upload.resource.handler}")
    private String  resourceHandler;
    @Value("${upload.resource.locations}")
    private String  resourceLocations;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //registry.addResourceHandler("/pic/**").addResourceLocations("file:D:/pic/");
        registry.addResourceHandler(resourceHandler).addResourceLocations(resourceLocations);
    }
}
